Move debian based bits to debian/ subdirectory
authorColin Walters <walters@verbum.org>
Sat, 12 Nov 2011 22:47:12 +0000 (17:47 -0500)
committerColin Walters <walters@verbum.org>
Sat, 12 Nov 2011 22:47:12 +0000 (17:47 -0500)
This is in preparation for introducing a Yocto-based variant.

gnomeos/0001-Support-OSTree.patch [deleted file]
gnomeos/debian-setup.sh [deleted file]
gnomeos/debian/0001-Support-OSTree.patch [new file with mode: 0644]
gnomeos/debian/debian-setup.sh [new file with mode: 0755]
gnomeos/debian/gnomeos-install.sh [new file with mode: 0755]
gnomeos/debian/gnomeos-make-base.sh [new file with mode: 0755]
gnomeos/debian/gnomeos-run.sh [new file with mode: 0755]
gnomeos/gnomeos-install.sh [deleted file]
gnomeos/gnomeos-make-base.sh [deleted file]
gnomeos/gnomeos-run.sh [deleted file]

diff --git a/gnomeos/0001-Support-OSTree.patch b/gnomeos/0001-Support-OSTree.patch
deleted file mode 100644 (file)
index 81fa4d4..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-From e9cb0f0c6ef13773c823610f27a562bd54b2acd3 Mon Sep 17 00:00:00 2001
-From: Colin Walters <walters@verbum.org>
-Date: Mon, 24 Oct 2011 22:01:17 -0400
-Subject: [PATCH] Support OSTree
-
-See http://git.gnome.org/browse/ostree
----
- modules.d/95rootfs-block/mount-root.sh |   12 ++++++------
- modules.d/99base/init                  |   32 ++++++++++++++++++++++----------
- 2 files changed, 28 insertions(+), 16 deletions(-)
-
-diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
-index 2c89431..4f411da 100755
---- a/modules.d/95rootfs-block/mount-root.sh
-+++ b/modules.d/95rootfs-block/mount-root.sh
-@@ -34,8 +34,8 @@ mount_root() {
-     READONLY=
-     fsckoptions=
--    if [ -f "$NEWROOT"/etc/sysconfig/readonly-root ]; then
--        . "$NEWROOT"/etc/sysconfig/readonly-root
-+    if [ -f "$NEWROOT_PREFIX"/etc/sysconfig/readonly-root ]; then
-+        . "$NEWROOT_PREFIX"/etc/sysconfig/readonly-root
-     fi
-     if getargbool 0 "readonlyroot=" -y readonlyroot; then
-@@ -57,7 +57,7 @@ mount_root() {
-     if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
-         fsckoptions="-f $fsckoptions"
-     elif [ -f "$NEWROOT"/.autofsck ]; then
--        [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
-+        [ -f "$NEWROOT_PREFIX"/etc/sysconfig/autofsck ] && . "$NEWROOT_PREFIX"/etc/sysconfig/autofsck
-         if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
-             AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
-         fi
-@@ -73,8 +73,8 @@ mount_root() {
-     rootopts=
-     if getargbool 1 rd.fstab -n rd_NO_FSTAB \
-         && ! getarg rootflags \
--        && [ -f "$NEWROOT/etc/fstab" ] \
--        && ! [ -L "$NEWROOT/etc/fstab" ]; then
-+        && [ -f "$NEWROOT_PREFIX/etc/fstab" ] \
-+        && ! [ -L "$NEWROOT_PREFIX/etc/fstab" ]; then
-         # if $NEWROOT/etc/fstab contains special mount options for
-         # the root filesystem,
-         # remount it with the proper options
-@@ -89,7 +89,7 @@ mount_root() {
-                 rootopts=$opts
-                 break
-             fi
--        done < "$NEWROOT/etc/fstab"
-+        done < "$NEWROOT_PREFIX/etc/fstab"
-         rootopts=$(filter_rootopts $rootopts)
-     fi
-diff --git a/modules.d/99base/init b/modules.d/99base/init
-index 36b2152..9636990 100755
---- a/modules.d/99base/init
-+++ b/modules.d/99base/init
-@@ -275,6 +275,13 @@ unset queuetriggered
- unset main_loop
- unset RDRETRY
-+ostree=$(getarg ostree=)
-+if test -n $ostree; then
-+    NEWROOT_PREFIX=${NEWROOT}/ostree/$ostree
-+else
-+    NEWROOT_PREFIX=$NEWROOT
-+fi
-+
- # pre-mount happens before we try to mount the root filesystem,
- # and happens once.
- getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
-@@ -287,14 +294,15 @@ getarg 'rd.break=mount' 'rdbreak=mount' && emergency_shell -n mount "Break mount
- i=0
- while :; do
-     if ismounted "$NEWROOT"; then
--        usable_root "$NEWROOT" && break;
-+        echo "Checking usable $NEWROOT_PREFIX"
-+        usable_root "$NEWROOT_PREFIX" && break;
-         umount "$NEWROOT"
-     fi
-     for f in $hookdir/mount/*.sh; do
-         [ -f "$f" ] && . "$f"
-         if ismounted "$NEWROOT"; then
--            usable_root "$NEWROOT" && break;
--            warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
-+            usable_root "$NEWROOT_PREFIX" && break;
-+            warn "$NEWROOT_PREFIX has no proper rootfs layout, ignoring and removing offending mount hook"
-             umount "$NEWROOT"
-             rm -f "$f"
-         fi
-@@ -320,11 +328,11 @@ unset __usr_found
- for i in "$(getarg real_init=)" "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
-     [ -n "$i" ] || continue
--    __p=$(readlink -m "$NEWROOT$i")
-+    __p=$(readlink -m "$NEWROOT_PREFIX$i")
-     if [ -n "$__p" ] \
-         && [ "x$__usr_found" = "x" ] \
-         && [ ! -x "$__p" ] \
--        && strstr "$__p" "$NEWROOT/usr" \
-+        && strstr "$__p" "$NEWROOT_PREFIX/usr" \
-         ; then
-         # we have to mount /usr
-         while read dev mp fs opts rest; do
-@@ -333,14 +341,14 @@ for i in "$(getarg real_init=)" "$(getarg init=)" /sbin/init /etc/init /init /bi
-                 __usr_found="1"
-                 break
-             fi
--        done < "$NEWROOT/etc/fstab" >> /etc/fstab
-+        done < "$NEWROOT_PREFIX/etc/fstab" >> /etc/fstab
-         if [ "x$__usr_found" != "x" ]; then
-             info "Mounting /usr"
--            mount "$NEWROOT/usr" 2>&1 | vinfo
-+            mount "$NEWROOT_PREFIX/usr" 2>&1 | vinfo
-         fi
-     fi
--    __p=$(readlink -f "$NEWROOT$i")
-+    __p=$(readlink -f "$NEWROOT_PREFIX$i")
-     if [ -x "$__p" ]; then
-         INIT="$i"
-         break
-@@ -445,7 +453,11 @@ info "Switching root"
- unset PS4
- CAPSH=$(command -v capsh)
--SWITCH_ROOT=$(command -v switch_root)
-+if test -n "${ostree}"; then
-+    SWITCH_ROOT=$(command -v ostree_switch_root)
-+else
-+    SWITCH_ROOT=$(command -v switch_root)
-+fi
- PATH=$OLDPATH
- export PATH
-@@ -463,7 +475,7 @@ if [ -f /etc/capsdrop ]; then
-     }
- else
-     unset RD_DEBUG
--    exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || {
-+    exec $SWITCH_ROOT "$NEWROOT" $ostree "$INIT" $initargs || {
-       warn "Something went very badly wrong in the initramfs.  Please "
-       warn "file a bug against dracut."
-       emergency_shell
--- 
-1.7.6.4
-
diff --git a/gnomeos/debian-setup.sh b/gnomeos/debian-setup.sh
deleted file mode 100755 (executable)
index 732a383..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-# This script sets up things we want to ship with the OS tree.  It should
-# NOT set up caches.  For example, do NOT run ldconfig in here.
-
-set -e
-set -x
-
-echo gnomeos >./etc/hostname
-
-cat >./etc/default/locale <<EOF
-LANG="en_US.UTF-8"
-EOF
-
-cp -p ./usr/share/sysvinit/inittab ./etc/inittab
-cp -p ./usr/share/base-files/nsswitch.conf ./etc/nsswitch.conf
-
-cat >./etc/pam.d/common-account <<EOF
-account [success=1 new_authtok_reqd=done default=ignore]        pam_unix.so 
-account requisite                       pam_deny.so
-account required                        pam_permit.so
-EOF
-cat >./etc/pam.d/common-auth <<EOF
-auth    [success=1 default=ignore]      pam_unix.so nullok_secure
-auth    requisite                       pam_deny.so
-auth    required                        pam_permit.so
-EOF
-cat >./etc/pam.d/common-password <<EOF
-password        [success=1 default=ignore]      pam_unix.so obscure sha512
-password        requisite                       pam_deny.so
-password        required                        pam_permit.so
-EOF
-cat >./etc/pam.d/common-session <<EOF
-session [default=1]                     pam_permit.so
-session requisite                       pam_deny.so
-session required                        pam_permit.so
-session required        pam_unix.so 
-EOF
-
-# base-passwd
-cp -p ./usr/share/base-passwd/passwd.master ./etc/passwd
-cp -p ./usr/share/base-passwd/group.master ./etc/group
-
-# Service rc.d defaults
-setuprc () {
-    name=$1
-    shift
-    type=$1
-    shift
-    priority=$1
-    shift
-    
-    for x in $@; do
-       ln -s ../init.d/$name ./etc/rc${x}.d/${type}${priority}${name}
-    done
-}
-    
-setuprc rsyslog S 10 2 3 4 5
-setuprc rsyslog S 30 0 6 
-setuprc rsyslog K 90 1
-setuprc cron S 89 2 3 4 5
diff --git a/gnomeos/debian/0001-Support-OSTree.patch b/gnomeos/debian/0001-Support-OSTree.patch
new file mode 100644 (file)
index 0000000..81fa4d4
--- /dev/null
@@ -0,0 +1,149 @@
+From e9cb0f0c6ef13773c823610f27a562bd54b2acd3 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters@verbum.org>
+Date: Mon, 24 Oct 2011 22:01:17 -0400
+Subject: [PATCH] Support OSTree
+
+See http://git.gnome.org/browse/ostree
+---
+ modules.d/95rootfs-block/mount-root.sh |   12 ++++++------
+ modules.d/99base/init                  |   32 ++++++++++++++++++++++----------
+ 2 files changed, 28 insertions(+), 16 deletions(-)
+
+diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
+index 2c89431..4f411da 100755
+--- a/modules.d/95rootfs-block/mount-root.sh
++++ b/modules.d/95rootfs-block/mount-root.sh
+@@ -34,8 +34,8 @@ mount_root() {
+     READONLY=
+     fsckoptions=
+-    if [ -f "$NEWROOT"/etc/sysconfig/readonly-root ]; then
+-        . "$NEWROOT"/etc/sysconfig/readonly-root
++    if [ -f "$NEWROOT_PREFIX"/etc/sysconfig/readonly-root ]; then
++        . "$NEWROOT_PREFIX"/etc/sysconfig/readonly-root
+     fi
+     if getargbool 0 "readonlyroot=" -y readonlyroot; then
+@@ -57,7 +57,7 @@ mount_root() {
+     if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
+         fsckoptions="-f $fsckoptions"
+     elif [ -f "$NEWROOT"/.autofsck ]; then
+-        [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
++        [ -f "$NEWROOT_PREFIX"/etc/sysconfig/autofsck ] && . "$NEWROOT_PREFIX"/etc/sysconfig/autofsck
+         if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
+             AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
+         fi
+@@ -73,8 +73,8 @@ mount_root() {
+     rootopts=
+     if getargbool 1 rd.fstab -n rd_NO_FSTAB \
+         && ! getarg rootflags \
+-        && [ -f "$NEWROOT/etc/fstab" ] \
+-        && ! [ -L "$NEWROOT/etc/fstab" ]; then
++        && [ -f "$NEWROOT_PREFIX/etc/fstab" ] \
++        && ! [ -L "$NEWROOT_PREFIX/etc/fstab" ]; then
+         # if $NEWROOT/etc/fstab contains special mount options for
+         # the root filesystem,
+         # remount it with the proper options
+@@ -89,7 +89,7 @@ mount_root() {
+                 rootopts=$opts
+                 break
+             fi
+-        done < "$NEWROOT/etc/fstab"
++        done < "$NEWROOT_PREFIX/etc/fstab"
+         rootopts=$(filter_rootopts $rootopts)
+     fi
+diff --git a/modules.d/99base/init b/modules.d/99base/init
+index 36b2152..9636990 100755
+--- a/modules.d/99base/init
++++ b/modules.d/99base/init
+@@ -275,6 +275,13 @@ unset queuetriggered
+ unset main_loop
+ unset RDRETRY
++ostree=$(getarg ostree=)
++if test -n $ostree; then
++    NEWROOT_PREFIX=${NEWROOT}/ostree/$ostree
++else
++    NEWROOT_PREFIX=$NEWROOT
++fi
++
+ # pre-mount happens before we try to mount the root filesystem,
+ # and happens once.
+ getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
+@@ -287,14 +294,15 @@ getarg 'rd.break=mount' 'rdbreak=mount' && emergency_shell -n mount "Break mount
+ i=0
+ while :; do
+     if ismounted "$NEWROOT"; then
+-        usable_root "$NEWROOT" && break;
++        echo "Checking usable $NEWROOT_PREFIX"
++        usable_root "$NEWROOT_PREFIX" && break;
+         umount "$NEWROOT"
+     fi
+     for f in $hookdir/mount/*.sh; do
+         [ -f "$f" ] && . "$f"
+         if ismounted "$NEWROOT"; then
+-            usable_root "$NEWROOT" && break;
+-            warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
++            usable_root "$NEWROOT_PREFIX" && break;
++            warn "$NEWROOT_PREFIX has no proper rootfs layout, ignoring and removing offending mount hook"
+             umount "$NEWROOT"
+             rm -f "$f"
+         fi
+@@ -320,11 +328,11 @@ unset __usr_found
+ for i in "$(getarg real_init=)" "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
+     [ -n "$i" ] || continue
+-    __p=$(readlink -m "$NEWROOT$i")
++    __p=$(readlink -m "$NEWROOT_PREFIX$i")
+     if [ -n "$__p" ] \
+         && [ "x$__usr_found" = "x" ] \
+         && [ ! -x "$__p" ] \
+-        && strstr "$__p" "$NEWROOT/usr" \
++        && strstr "$__p" "$NEWROOT_PREFIX/usr" \
+         ; then
+         # we have to mount /usr
+         while read dev mp fs opts rest; do
+@@ -333,14 +341,14 @@ for i in "$(getarg real_init=)" "$(getarg init=)" /sbin/init /etc/init /init /bi
+                 __usr_found="1"
+                 break
+             fi
+-        done < "$NEWROOT/etc/fstab" >> /etc/fstab
++        done < "$NEWROOT_PREFIX/etc/fstab" >> /etc/fstab
+         if [ "x$__usr_found" != "x" ]; then
+             info "Mounting /usr"
+-            mount "$NEWROOT/usr" 2>&1 | vinfo
++            mount "$NEWROOT_PREFIX/usr" 2>&1 | vinfo
+         fi
+     fi
+-    __p=$(readlink -f "$NEWROOT$i")
++    __p=$(readlink -f "$NEWROOT_PREFIX$i")
+     if [ -x "$__p" ]; then
+         INIT="$i"
+         break
+@@ -445,7 +453,11 @@ info "Switching root"
+ unset PS4
+ CAPSH=$(command -v capsh)
+-SWITCH_ROOT=$(command -v switch_root)
++if test -n "${ostree}"; then
++    SWITCH_ROOT=$(command -v ostree_switch_root)
++else
++    SWITCH_ROOT=$(command -v switch_root)
++fi
+ PATH=$OLDPATH
+ export PATH
+@@ -463,7 +475,7 @@ if [ -f /etc/capsdrop ]; then
+     }
+ else
+     unset RD_DEBUG
+-    exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || {
++    exec $SWITCH_ROOT "$NEWROOT" $ostree "$INIT" $initargs || {
+       warn "Something went very badly wrong in the initramfs.  Please "
+       warn "file a bug against dracut."
+       emergency_shell
+-- 
+1.7.6.4
+
diff --git a/gnomeos/debian/debian-setup.sh b/gnomeos/debian/debian-setup.sh
new file mode 100755 (executable)
index 0000000..732a383
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/sh
+# This script sets up things we want to ship with the OS tree.  It should
+# NOT set up caches.  For example, do NOT run ldconfig in here.
+
+set -e
+set -x
+
+echo gnomeos >./etc/hostname
+
+cat >./etc/default/locale <<EOF
+LANG="en_US.UTF-8"
+EOF
+
+cp -p ./usr/share/sysvinit/inittab ./etc/inittab
+cp -p ./usr/share/base-files/nsswitch.conf ./etc/nsswitch.conf
+
+cat >./etc/pam.d/common-account <<EOF
+account [success=1 new_authtok_reqd=done default=ignore]        pam_unix.so 
+account requisite                       pam_deny.so
+account required                        pam_permit.so
+EOF
+cat >./etc/pam.d/common-auth <<EOF
+auth    [success=1 default=ignore]      pam_unix.so nullok_secure
+auth    requisite                       pam_deny.so
+auth    required                        pam_permit.so
+EOF
+cat >./etc/pam.d/common-password <<EOF
+password        [success=1 default=ignore]      pam_unix.so obscure sha512
+password        requisite                       pam_deny.so
+password        required                        pam_permit.so
+EOF
+cat >./etc/pam.d/common-session <<EOF
+session [default=1]                     pam_permit.so
+session requisite                       pam_deny.so
+session required                        pam_permit.so
+session required        pam_unix.so 
+EOF
+
+# base-passwd
+cp -p ./usr/share/base-passwd/passwd.master ./etc/passwd
+cp -p ./usr/share/base-passwd/group.master ./etc/group
+
+# Service rc.d defaults
+setuprc () {
+    name=$1
+    shift
+    type=$1
+    shift
+    priority=$1
+    shift
+    
+    for x in $@; do
+       ln -s ../init.d/$name ./etc/rc${x}.d/${type}${priority}${name}
+    done
+}
+    
+setuprc rsyslog S 10 2 3 4 5
+setuprc rsyslog S 30 0 6 
+setuprc rsyslog K 90 1
+setuprc cron S 89 2 3 4 5
diff --git a/gnomeos/debian/gnomeos-install.sh b/gnomeos/debian/gnomeos-install.sh
new file mode 100755 (executable)
index 0000000..1da0361
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+# -*- indent-tabs-mode: nil; -*-
+# Install built ostree image to current system
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+set -x
+
+SRCDIR=`dirname $0`
+WORKDIR=`pwd`
+
+OBJ=gnomeos-initrd.img
+if ! test -f ${OBJ}; then
+    echo "Error: couldn't find '$OBJ'. Run gnomeos-make-image.sh"
+    exit 1
+fi
+
+if test -d /ostree; then
+    echo "/ostree already exists"
+    exit 1
+fi
+
+cp -a gnomeos-fs/ostree /
+initrd=`readlink gnomeos-initrd.img`
+cp ${initrd} /boot
+grubby --title "GNOME OS" --add-kernel=$kernel --copy-default --initrd=/boot/${initrd}
diff --git a/gnomeos/debian/gnomeos-make-base.sh b/gnomeos/debian/gnomeos-make-base.sh
new file mode 100755 (executable)
index 0000000..50e29d5
--- /dev/null
@@ -0,0 +1,205 @@
+#!/bin/sh
+# -*- indent-tabs-mode: nil; -*-
+# Generate a root filesystem image
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+set -x
+
+SRCDIR=`dirname $0`
+WORKDIR=`pwd`
+
+DEPENDS="debootstrap"
+
+for x in $DEPENDS; do
+    if ! command -v $x; then
+        cat <<EOF
+Couldn't find required dependency $x
+EOF
+        exit 1
+    fi
+done
+
+if test $(id -u) == 0; then
+    echo "Should not run this script as root."
+    exit 1
+fi
+
+if test -z "${OSTREE}"; then
+    OSTREE=`command -v ostree || true`
+fi
+if test -z "${OSTREE}"; then
+    cat <<EOF
+ERROR:
+Couldn't find ostree; you can set the OSTREE environment variable to point to it
+e.g.: OSTREE=~user/checkout/ostree/ostree $0
+EOF
+    exit 1
+fi
+
+if test -z "$DRACUT"; then
+    if ! test -d dracut; then
+        cat <<EOF
+Checking out and patching dracut...
+EOF
+        git clone git://git.kernel.org/pub/scm/boot/dracut/dracut.git
+        (cd dracut; git am $SRCDIR/0001-Support-OSTree.patch)
+        (cd dracut; make)
+    fi
+    DRACUT=`pwd`/dracut/dracut
+fi
+
+case `uname -p` in
+    x86_64)
+        ARCH=amd64
+        ;;
+    *)
+        echo "Unsupported architecture"
+        ;;
+esac;
+
+DEBTARGET=wheezy
+
+INITRD_MOVE_MOUNTS="dev proc sys"
+TOPROOT_BIND_MOUNTS="boot home root tmp"
+OSTREE_BIND_MOUNTS="var"
+MOVE_MOUNTS="selinux mnt media"
+READONLY_BIND_MOUNTS="bin etc lib lib32 lib64 sbin usr"
+
+cd ${WORKDIR}
+OBJ=debootstrap-$DEBTARGET
+if ! test -d ${OBJ} ; then
+    echo "Creating $DEBTARGET.img"
+    mkdir -p ${OBJ}.tmp
+    debootstrap --download-only --arch $ARCH $DEBTARGET ${OBJ}.tmp
+    mv ${OBJ}.tmp ${OBJ}
+fi
+
+cd ${WORKDIR}
+OBJ=$DEBTARGET-fs
+if ! test -d ${OBJ}; then
+    rm -rf ${OBJ}.tmp
+    mkdir ${OBJ}.tmp
+
+    cd ${OBJ}.tmp;
+    mkdir -m 0755 $INITRD_MOVE_MOUNTS $TOPROOT_BIND_MOUNTS
+    chmod a=rwxt tmp
+
+    mkdir ostree
+
+    mkdir -p -m 0755 ostree/var/{log,run}
+
+    mkdir ostree/repo
+
+    $OSTREE --repo=ostree/repo init 
+    
+    BRANCHES=""
+
+    mkdir ostree/worktree
+    cd ostree/worktree
+    mkdir -m 0755 $INITRD_MOVE_MOUNTS $TOPROOT_BIND_MOUNTS $OSTREE_BIND_MOUNTS $READONLY_BIND_MOUNTS $MOVE_MOUNTS sysroot
+    chmod a=rwxt tmp
+    $OSTREE --repo=../repo commit -b gnomeos-filesystem -s "Base filesystem layout"
+    BRANCHES="$BRANCHES gnomeos-filesystem"
+    cd ..
+    rm -rf worktree
+
+    for d in ${WORKDIR}/debootstrap-$DEBTARGET/var/cache/apt/archives/*.deb; do
+        bn=$(basename $d)
+        debname=$(echo $bn | cut -f 1 -d _)
+        debversion=$(echo $bn | cut -f 2 -d _)
+        archivename="archive-${debname}"
+        rm -rf worktree; mkdir worktree;
+        cd worktree;
+        mkdir data;
+        ar x $d;
+        tar -x -z -C data -f data.tar.gz;
+        cd data;
+        $OSTREE --repo=../../repo commit -b "${archivename}" -s "Version ${debversion}"
+        BRANCHES="$BRANCHES $archivename"
+        cd ../..
+    done
+    rm -rf worktree
+
+    $OSTREE --repo=repo compose --out-metadata=./compose-meta worktree $BRANCHES
+    cd worktree
+    $OSTREE --repo=../repo commit --metadata-variant=../compose-meta -b gnomeos -s "Compose of Debian $DEBTARGET"
+    cd ..
+    rm -rf worktree
+    
+    cd ${WORKDIR}
+    if test -d ${OBJ}; then
+        mv ${OBJ} ${OBJ}.old
+    fi
+    mv ${OBJ}.tmp ${OBJ}
+    rm -rf ${OBJ}.old
+fi
+
+# TODO download source for above
+# TODO download build dependencies for above
+
+cd ${WORKDIR}
+OBJ=gnomeos-fs
+if ! test -d ${OBJ}; then
+    rm -rf ${OBJ}.tmp
+    cp -al $DEBTARGET-fs ${OBJ}.tmp
+    cd ${OBJ}.tmp/ostree;
+    rm -rf worktree
+    $OSTREE --repo=repo checkout gnomeos worktree
+    cd worktree
+    ${SRCDIR}/debian-setup.sh
+    $OSTREE --repo=../repo commit -b gnomeos -s "Run debian-setup.sh"
+    cd ..
+    rm -rf worktree
+
+    rev=$($OSTREE --repo=repo rev-parse gnomeos);
+    $OSTREE --repo=repo checkout ${rev} gnomeos-${rev}
+    $OSTREE --repo=repo run-triggers gnomeos-${rev}
+    ln -s gnomeos-${rev} current
+    
+    cd ${WORKDIR}
+    if test -d ${OBJ}; then
+        mv ${OBJ} ${OBJ}.old
+    fi
+    mv ${OBJ}.tmp ${OBJ}
+    rm -rf ${OBJ}.old
+fi
+
+cd ${WORKDIR}
+(cd ${SRCDIR}/..;
+ make ostree_switch_root;
+ cp ostree_switch_root ${WORKDIR})
+
+kv=`uname -r`
+kernel=/boot/vmlinuz-${kv}
+if ! test -f "${kernel}"; then
+    cat <<EOF
+Failed to find ${kernel}
+EOF
+fi
+
+cd ${WORKDIR}
+OBJ=gnomeos-initrd.img
+VOBJ=gnomeos-initrd-${kv}.img
+if ! test -f ${OBJ}; then
+    rm -f ${OBJ}.tmp ${VOBJ}.tmp
+    $DRACUT -l -v -o plymouth --include `pwd`/ostree_switch_root /sbin/ostree_switch_root ${VOBJ}.tmp
+    mv ${VOBJ}.tmp ${VOBJ}
+    ln -sf ${VOBJ} gnomeos-initrd.img
+fi
diff --git a/gnomeos/debian/gnomeos-run.sh b/gnomeos/debian/gnomeos-run.sh
new file mode 100755 (executable)
index 0000000..727f1b8
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+# -*- indent-tabs-mode: nil; -*-
+# Run built image in QEMU 
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -e
+set -x
+
+SRCDIR=`dirname $0`
+WORKDIR=`pwd`
+
+if ! test -d gnomeos-fs; then
+    echo "Error: couldn't find gnomeos-fs. Run gnomeos-make-image.sh"
+    exit 1
+fi
+
+OBJ=gnomeos-fs.img
+if (! test -f ${OBJ}) || test gnomeos-fs -nt ${OBJ}; then
+    rm -f ${OBJ}.tmp
+    qemu-img create ${OBJ}.tmp 2G
+    mkfs.ext4 -q -F ${OBJ}.tmp
+    mkdir -p fs
+    umount fs || true
+    mount -o loop ${OBJ}.tmp fs
+    cp -a gnomeos-fs/* fs
+    umount fs
+    mv ${OBJ}.tmp ${OBJ}
+fi
+
+kv=`uname -r`
+kernel=/boot/vmlinuz-${kv}
+
+exec qemu-kvm -kernel ${kernel} -initrd gnomeos-initrd.img -hda gnomeos-fs.img -append "root=/dev/sda ostree=current $1"
diff --git a/gnomeos/gnomeos-install.sh b/gnomeos/gnomeos-install.sh
deleted file mode 100755 (executable)
index 1da0361..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-# -*- indent-tabs-mode: nil; -*-
-# Install built ostree image to current system
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-set -x
-
-SRCDIR=`dirname $0`
-WORKDIR=`pwd`
-
-OBJ=gnomeos-initrd.img
-if ! test -f ${OBJ}; then
-    echo "Error: couldn't find '$OBJ'. Run gnomeos-make-image.sh"
-    exit 1
-fi
-
-if test -d /ostree; then
-    echo "/ostree already exists"
-    exit 1
-fi
-
-cp -a gnomeos-fs/ostree /
-initrd=`readlink gnomeos-initrd.img`
-cp ${initrd} /boot
-grubby --title "GNOME OS" --add-kernel=$kernel --copy-default --initrd=/boot/${initrd}
diff --git a/gnomeos/gnomeos-make-base.sh b/gnomeos/gnomeos-make-base.sh
deleted file mode 100755 (executable)
index 235808c..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/bin/sh
-# -*- indent-tabs-mode: nil; -*-
-# Generate a root filesystem image
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-set -x
-
-SRCDIR=`dirname $0`
-WORKDIR=`pwd`
-
-DEPENDS="debootstrap"
-
-for x in $DEPENDS; do
-    if ! command -v $x; then
-        cat <<EOF
-Couldn't find required dependency $x
-EOF
-        exit 1
-    fi
-done
-
-if test $(id -u) == 0; then
-    echo "Should not run this script as root."
-    exit 1
-fi
-
-if test -z "${OSTREE}"; then
-    OSTREE=`command -v ostree || true`
-fi
-if test -z "${OSTREE}"; then
-    cat <<EOF
-ERROR:
-Couldn't find ostree; you can set the OSTREE environment variable to point to it
-e.g.: OSTREE=~user/checkout/ostree/ostree $0
-EOF
-    exit 1
-fi
-
-if test -z "$DRACUT"; then
-    if ! test -d dracut; then
-        cat <<EOF
-Checking out and patching dracut...
-EOF
-        git clone git://git.kernel.org/pub/scm/boot/dracut/dracut.git
-        (cd dracut; git am $SRCDIR/0001-Support-OSTree.patch)
-        (cd dracut; make)
-    fi
-    DRACUT=`pwd`/dracut/dracut
-fi
-
-case `uname -p` in
-    x86_64)
-        ARCH=amd64
-        ;;
-    *)
-        echo "Unsupported architecture"
-        ;;
-esac;
-
-DEBTARGET=wheezy
-
-INITRD_MOVE_MOUNTS="dev proc sys"
-TOPROOT_BIND_MOUNTS="boot home root tmp"
-OSTREE_BIND_MOUNTS="var"
-MOVE_MOUNTS="selinux mnt media"
-READONLY_BIND_MOUNTS="bin etc lib lib32 lib64 sbin usr"
-
-cd ${WORKDIR}
-OBJ=debootstrap-$DEBTARGET
-if ! test -d ${OBJ} ; then
-    echo "Creating $DEBTARGET.img"
-    mkdir -p ${OBJ}.tmp
-    debootstrap --download-only --arch $ARCH $DEBTARGET ${OBJ}.tmp
-    mv ${OBJ}.tmp ${OBJ}
-fi
-
-cd ${WORKDIR}
-OBJ=$DEBTARGET-fs
-if ! test -d ${OBJ}; then
-    rm -rf ${OBJ}.tmp
-    mkdir ${OBJ}.tmp
-
-    cd ${OBJ}.tmp;
-    mkdir -m 0755 $INITRD_MOVE_MOUNTS $TOPROOT_BIND_MOUNTS
-    chmod a=rwxt tmp
-
-    mkdir ostree
-
-    mkdir -p -m 0755 ostree/var/{log,run}
-
-    mkdir ostree/repo
-
-    $OSTREE --repo=ostree/repo init 
-    
-    BRANCHES=""
-
-    mkdir ostree/worktree
-    cd ostree/worktree
-    mkdir -m 0755 $INITRD_MOVE_MOUNTS $TOPROOT_BIND_MOUNTS $OSTREE_BIND_MOUNTS $READONLY_BIND_MOUNTS $MOVE_MOUNTS sysroot
-    chmod a=rwxt tmp
-    $OSTREE --repo=../repo commit -b gnomeos-filesystem -s "Base filesystem layout"
-    BRANCHES="$BRANCHES gnomeos-filesystem"
-    cd ..
-    rm -rf worktree
-
-    for d in ${WORKDIR}/debootstrap-$DEBTARGET/var/cache/apt/archives/*.deb; do
-        bn=$(basename $d)
-        debname=$(echo $bn | cut -f 1 -d _)
-        debversion=$(echo $bn | cut -f 2 -d _)
-        archivename="archive-${debname}"
-        rm -rf worktree; mkdir worktree;
-        cd worktree;
-        mkdir data;
-        ar x $d;
-        tar -x -z -C data -f data.tar.gz;
-        cd data;
-        $OSTREE --repo=../../repo commit -b "${archivename}" -s "Version ${debversion}"
-        BRANCHES="$BRANCHES $archivename"
-        cd ../..
-    done
-    rm -rf worktree
-
-    $OSTREE --repo=repo compose --out-metadata=./compose-meta worktree $BRANCHES
-    cd worktree
-    $OSTREE --repo=../repo commit --metadata-variant=../compose-meta -b gnomeos -s "Compose of Debian $DEBTARGET"
-    cd ..
-    rm -rf worktree
-    
-    cd ${WORKDIR}
-    if test -d ${OBJ}; then
-        mv ${OBJ} ${OBJ}.old
-    fi
-    mv ${OBJ}.tmp ${OBJ}
-    rm -rf ${OBJ}.old
-fi
-
-# TODO download source for above
-# TODO download build dependencies for above
-
-cd ${WORKDIR}
-OBJ=gnomeos-fs
-if ! test -d ${OBJ}; then
-    rm -rf ${OBJ}.tmp
-    cp -al $DEBTARGET-fs ${OBJ}.tmp
-    cd ${OBJ}.tmp/ostree;
-    rm -rf worktree
-    $OSTREE --repo=repo checkout gnomeos worktree
-    cd worktree
-    ${SRCDIR}/debian-setup.sh
-    $OSTREE --repo=../repo commit -b gnomeos -s "Run debian-setup.sh"
-    cd ..
-    rm -rf worktree
-
-    rev=$($OSTREE --repo=repo rev-parse gnomeos);
-    $OSTREE --repo=repo checkout ${rev} gnomeos-${rev}
-    $OSTREE --repo=repo run-triggers gnomeos-${rev}
-    ln -s gnomeos-${rev} current
-    
-    cd ${WORKDIR}
-    if test -d ${OBJ}; then
-        mv ${OBJ} ${OBJ}.old
-    fi
-    mv ${OBJ}.tmp ${OBJ}
-    rm -rf ${OBJ}.old
-fi
-
-cd ${WORKDIR}
-cp ${SRCDIR}/ostree_switch_root ${WORKDIR}
-
-kv=`uname -r`
-kernel=/boot/vmlinuz-${kv}
-if ! test -f "${kernel}"; then
-    cat <<EOF
-Failed to find ${kernel}
-EOF
-fi
-
-cd ${WORKDIR}
-OBJ=gnomeos-initrd.img
-VOBJ=gnomeos-initrd-${kv}.img
-if ! test -f ${OBJ}; then
-    rm -f ${OBJ}.tmp ${VOBJ}.tmp
-    $DRACUT -l -v -o plymouth --include `pwd`/ostree_switch_root /sbin/ostree_switch_root ${VOBJ}.tmp
-    mv ${VOBJ}.tmp ${VOBJ}
-    ln -sf ${VOBJ} gnomeos-initrd.img
-fi
diff --git a/gnomeos/gnomeos-run.sh b/gnomeos/gnomeos-run.sh
deleted file mode 100755 (executable)
index 727f1b8..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-# -*- indent-tabs-mode: nil; -*-
-# Run built image in QEMU 
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-set -e
-set -x
-
-SRCDIR=`dirname $0`
-WORKDIR=`pwd`
-
-if ! test -d gnomeos-fs; then
-    echo "Error: couldn't find gnomeos-fs. Run gnomeos-make-image.sh"
-    exit 1
-fi
-
-OBJ=gnomeos-fs.img
-if (! test -f ${OBJ}) || test gnomeos-fs -nt ${OBJ}; then
-    rm -f ${OBJ}.tmp
-    qemu-img create ${OBJ}.tmp 2G
-    mkfs.ext4 -q -F ${OBJ}.tmp
-    mkdir -p fs
-    umount fs || true
-    mount -o loop ${OBJ}.tmp fs
-    cp -a gnomeos-fs/* fs
-    umount fs
-    mv ${OBJ}.tmp ${OBJ}
-fi
-
-kv=`uname -r`
-kernel=/boot/vmlinuz-${kv}
-
-exec qemu-kvm -kernel ${kernel} -initrd gnomeos-initrd.img -hda gnomeos-fs.img -append "root=/dev/sda ostree=current $1"